package com.yl.project.lvyou.knowledge.service.impl;

import java.util.List;
import com.yl.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yl.project.lvyou.knowledge.mapper.QaKnowledgeMapper;
import com.yl.project.lvyou.knowledge.domain.QaKnowledge;
import com.yl.project.lvyou.knowledge.service.IQaKnowledgeService;
import com.yl.common.utils.text.Convert;
import com.yl.framework.config.BaseService;

/**
 * 咨询问答知识库Service业务层处理
 * 
 * @author yl
 * @date 2025-03-16
 */
@Service
public class QaKnowledgeServiceImpl extends BaseService<QaKnowledge> implements IQaKnowledgeService 
{
    @Autowired
    private QaKnowledgeMapper qaKnowledgeMapper;

    /**
     * 查询咨询问答知识库
     * 
     * @param id 咨询问答知识库ID
     * @return 咨询问答知识库
     */
    @Override
    public QaKnowledge selectQaKnowledgeById(Long id)
    {
        return qaKnowledgeMapper.selectQaKnowledgeById(id);
    }

    /**
     * 查询咨询问答知识库列表
     * 
     * @param qaKnowledge 咨询问答知识库
     * @return 咨询问答知识库
     */
    @Override
    public List<QaKnowledge> selectQaKnowledgeList(QaKnowledge qaKnowledge)
    {
        return qaKnowledgeMapper.selectQaKnowledgeList(qaKnowledge);
    }

    /**
     * 新增咨询问答知识库
     * 
     * @param qaKnowledge 咨询问答知识库
     * @return 结果
     */
    @Override
    public int insertQaKnowledge(QaKnowledge qaKnowledge)
    {
        qaKnowledge.setCreateTime(DateUtils.getNowDate());
        return qaKnowledgeMapper.insertQaKnowledge(qaKnowledge);
    }

    /**
     * 修改咨询问答知识库
     * 
     * @param qaKnowledge 咨询问答知识库
     * @return 结果
     */
    @Override
    public int updateQaKnowledge(QaKnowledge qaKnowledge)
    {
        qaKnowledge.setUpdateTime(DateUtils.getNowDate());
        return qaKnowledgeMapper.updateQaKnowledge(qaKnowledge);
    }

    /**
     * 删除咨询问答知识库对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteQaKnowledgeByIds(String ids)
    {
        return qaKnowledgeMapper.deleteQaKnowledgeByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除咨询问答知识库信息
     * 
     * @param id 咨询问答知识库ID
     * @return 结果
     */
    @Override
    public int deleteQaKnowledgeById(Long id)
    {
        return qaKnowledgeMapper.deleteQaKnowledgeById(id);
    }

    @Override
    public QaKnowledge selectQaKnowledgeAnswert(QaKnowledge qaKnowledge) {
        return qaKnowledgeMapper.selectQaKnowledgeAnswert(qaKnowledge);
    }

    @Override
    public List<QaKnowledge> selectQaKnowledgeListQa(QaKnowledge qaKnowledge) {
        return qaKnowledgeMapper.selectQaKnowledgeListQa(qaKnowledge);
    }
}
